<%--
  Created by IntelliJ IDEA.
  User: Mr.Zhang
  Date: 2025/1/6
  Time: 09:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta charset="UTF-8">
  <title>工序物料设计单审核子页面</title>
  <link rel="stylesheet"  href="/bootstrap/bootstrap-5.3.3-dist/css/bootstrap.min.css" />
  <link rel="stylesheet" href="/css/manufactureCss/b/Process_material_design_sheet_review.css" />
  <style type="text/css">

  </style>
</head>
<body style="padding: 15px 50px;background-color: #eeeeee;">
<div class="panel-heading hhead">
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <span style="color: blue;">您正在做的业务是：</span>
      <li class="breadcrumb-item"><a href="#">生产管理</a></li>
      <li class="breadcrumb-item"><a href="#">工序物料设计</a></li>
      <li class="breadcrumb-item active" aria-current="page">工序物料设计单审核</li>
    </ol>
  </nav>
</div>
<div style="margin-bottom: 2px">
  <div style="display: inline;margin-left: 94%;">
    <%--        <button class="btn btn-primary">返回</button>--%>
  </div>
</div> <!-- 此div改用栅格来做 -->
<div id="designListBox">
  <div style="text-align: center">
    <h3>工序物料设计单</h3>
  </div>
  <div style="padding: 30px">
    <table class="tbl1">
      <tr>
        <td class="col1">派工单编号：</td>
        <td class="col2" id="manufactureId"></td>
        <td class="col1">工序名称：</td>
        <td class="col2" id="procedureName"></td>
      </tr>
<%--      <tr>--%>
<%--        <td class="col1">登记人：</td>--%>
<%--        <td colspan="1" id="register">aadmin</td>--%>
<%--        <td class="col1">登记时间：</td>--%>
<%--        <td colspan="2" id="registerTime">2024-11-11</td>--%>
<%--      </tr>--%>
    </table>

    <table id="tbl2" class="table table-bordered" style="margin: 15px auto;">
      <thead>
      <tr>
        <th>序号</th><th width="200px">物料名称</th><th width="140px">物料编号</th>
        <th width="200px">描述</th><th>本工序数量</th><th>单位</th>
        <th>单价（元）</th><th>小计（元）</th>
      </tr>
      </thead>
      <tbody id="template">
      <tr>
        <td>1</td>
        <td>aaaaaa</td>
        <td>aaaa</td>
        <td>a</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      </tbody>
    </table>
  </div>
</div>
<script type="text/javascript" src="/js/jquery-3.7.0.min.js"></script>
<script type="text/javascript" src="/bootstrap/bootstrap-5.3.3-dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript">
  $(function () {
    initialTable();
    initialModule();
  })
  function initialModule(){
    let id = sessionStorage.getItem("id");
    $.ajax({
      url: "/m-procedure-module/initialModule?id="+id,
      type: "get",
      dataType: "json",
      success: function (data) {
        if(data!=null){
          let tbody = $("#template");
          tbody.empty();
          for(let i=0;i<data.length;i++) {
            let tr = $("<tr></tr>");
            let td1 = $("<td></td>").text(i+1);
            let td2 = $("<td></td>").text(data[i].productName);
            let td3 = $("<td></td>").text(data[i].productId);
            let td4 = $("<td></td>").text(data[i].productDescribe);
            let td5 = $("<td></td>").text(data[i].amount);
            let td6 = $("<td></td>").text(data[i].amountUnit);
            let td7 = $("<td></td>").text(data[i].costPrice);
            let td8 = $("<td></td>").text(data[i].subtotal);
            tr.append(td1,td2,td3,td4,td5,td6,td7,td8);
            tbody.append(tr);
          }
        }
      },
      error: function (data) {
        console.log(data);
      }
    })
  }
  function initialTable(){
    let manufactureId = sessionStorage.getItem("manufactureId");
    $("#manufactureId").text(manufactureId);
    let procedureName = sessionStorage.getItem("procedureName")
    $("#procedureName").text(procedureName);
    // let register = sessionStorage.getItem("register");
    // $("#register").text(register);
    // let registerTime = sessionStorage.getItem("registerTime");
    // $("#registerTime").text(registerTime);

  }
</script>
</body>
</html>
